﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Algorithm_2.Easy_434_CountSegments
{
    class MainProject
    {
        static void Main(string[] args)
        {
            //int[] intArray1 = new int[] { 4, 9, 5 };
            //int[] intArray2 = new int[] { 2, 2, 3, 1 };
            
            //Console.WriteLine(CountSegments("      df  dfd     "));
            Console.WriteLine(CountSegments("          "));
            Console.ReadKey();

        }

        public static int CountSegments(string s)
        {
            s = s.Trim();
            if (string.IsNullOrEmpty(s)) return 0;
            string[] strs = s.Split(' ');
            int index = 0;
            for (int i = 0; i < strs.Length; i++)
            {
                if (!string.IsNullOrEmpty(strs[i]))
                {
                    index++;
                }
            }

            return index;
        }
    }
}
